from sqlalchemy import create_engine

def connect():
    #初始化数据库连接
    engine = create_engine(
        "mysql+pymysql://root:123456@localhost:3306/"
        "bookstore?charset=utf8mb4",
        max_overflow = 0, #超过连接池大小外最多创建的连接数
        pool_size = 5, #连接池大小
    )
    print("数据库连接成功！") #输出数据连接
    return engine
if __name__ == "__main__": #作为主程序执行
    connect()